<html>
<head><meta charset="utf-8"><title>Fixing #3188 · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html">Fixing #3188</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220483117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220483117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220483117">(Dec 19 2020 at 19:18)</a>:</h4>
<p>Looks like I'm finally working towards an effective solution for <a href="https://github.com/rust-analyzer/rust-analyzer/issues/3188">https://github.com/rust-analyzer/rust-analyzer/issues/3188</a>:</p>
<div class="codehilite"><pre><span></span><code>        16069ms - crate_def_map_query @ salsa
               13ms - crate_def_map:wait (24610 calls)
             4816ms - item_tree_query (8202 calls)
            10773ms - macro_expand (8201 calls)
                0ms - rewrite (1 calls)
              465ms - ???
</code></pre></div>
<p>I'm not sure why this is so slow now, I might have accidentally implemented procedural attribute macros</p>



<a name="220483252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220483252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220483252">(Dec 19 2020 at 19:22)</a>:</h4>
<p><code>[ERROR hir_def::nameres::collector] name resolution is stuck</code></p>
<p>Clearly something broke :)</p>



<a name="220484062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484062">(Dec 19 2020 at 19:40)</a>:</h4>
<p>Heh, new features which regress performance considerably are my favorite!</p>



<a name="220484080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484080">(Dec 19 2020 at 19:40)</a>:</h4>
<p><em>First</em> you an tweet about new feature, and <em>next week</em> you can tween about perfomrnace improving 2x!</p>



<a name="220484193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484193">(Dec 19 2020 at 19:43)</a>:</h4>
<div class="codehilite"><pre><span></span><code>thread &#39;&lt;unknown&gt;&#39; has overflowed its stack
fatal runtime error: stack overflow
</code></pre></div>
<p>huh, looks like the overflow guards in name resolution are not enough</p>



<a name="220484359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484359">(Dec 19 2020 at 19:47)</a>:</h4>
<div class="codehilite"><pre><span></span><code>38480ms - crate_def_map_query @ hir_def
    15767ms - crate_def_map:wait
        124ms - DefCollector::resolve_macros @ 21 macros, 748 attrs
            0ms - crate_def_map:wait (1517 calls)
            33ms - item_tree_query (766 calls)
            73ms - macro_expand (766 calls)
            0ms - rewrite (2 calls)
    18502ms - DefCollector::resolve_macros (8191 calls)
</code></pre></div>
<p>odd profiler output, it's only including the <code>.detail()</code> once</p>



<a name="220484422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484422">(Dec 19 2020 at 19:48)</a>:</h4>
<p>yes, apparently, for <em>some crate</em>, we're now expanding 748 attribute macros</p>



<a name="220484603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484603">(Dec 19 2020 at 19:52)</a>:</h4>
<p>Practically all it does is crash the proc macro server, looks like we'll have to come up with a more stable solution for that before this work properly...</p>



<a name="220484637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484637">(Dec 19 2020 at 19:53)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink</span> reminder that this is a thing: <a href="https://github.com/matklad/backtrace-on-stack-overflow">https://github.com/matklad/backtrace-on-stack-overflow</a></p>



<a name="220484725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Fixing%20%233188/near/220484725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Fixing.20.233188.html#220484725">(Dec 19 2020 at 19:55)</a>:</h4>
<p>oh well this explains the "name resolution is stuck" error, salsa runs right into the iteration limit</p>
<div class="codehilite"><pre><span></span><code>        15699ms - crate_def_map_query @ salsa
            15695ms - DefCollector::resolve_macros (8192 calls)
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>